package com.kiln.juxingqs.ui.vm

import android.app.Application
import androidx.lifecycle.MutableLiveData
import client.global.commlib.network.data.JsonResult
import client.global.commlib.network.data.Ret
import com.kiln.juxingqs.api.bean.Zcjl
import com.kiln.juxingqs.api.bean.ZrAndSgRet
import com.kiln.juxingqs.ui.viewmodel.MiddleVm


class XyzrViewModel(app: Application) : MiddleVm(app) {
    val isShowing = MutableLiveData<Boolean>(false)

    val isOneLoading = MutableLiveData<Boolean>(false)
    val pageOne = MutableLiveData<Int>(0)
    val callOne = MutableLiveData<JsonResult<Zcjl>>()
    val cancleRet = MutableLiveData<JsonResult<Ret>>()
    val queRenRet = MutableLiveData<JsonResult<Ret>>()

    fun querenOrder(b: ZrAndSgRet.Order) {
        hold({
            server.buyer_confirm(
                "${b.order_id}"
            )
        }, {
            isShowing.value = true
        }, {
            queRenRet.value = it
        }, complete = {
            isShowing.value = false

        })
    }

    fun cancelOrder(b: ZrAndSgRet.Order) {
        hold({
            server.del_transfer_order(
                "${b.order_id}"
            )
        }, {
            isShowing.value = true
        }, {
            cancleRet.value = it
        }, complete = {
            isShowing.value = false
        })
    }



}